﻿/*
**贷款详情页面
*/
Chenxin.UI.ShowDetialLoanPage = Chenxin.extend(Chenxin.UI.AddPageCommon,{
    actionUrl:"/service/logic/ShowDetailLoan.ashx",
    createForm:function(){
		return new Chenxin.UI.ShowDetialLoanForm({
			scope:this
		});
	}
});

Chenxin.UI.ShowDetialLoanForm = Chenxin.extend(Chenxin.UI.AddFormCommon,{
    actionUrl:"/service/logic/ShowDetailLoan.ashx",
    id: 'DetialLoan_form',
    loadinfo: function(callback,scope) {
        var _this = this;
        if (!this.currentId) {
            alert("请先选择一条记录！");
            return false;
        }
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async: false,
            url: '/service/logic/DealLoan.ashx',
            data: { op: 'getmodel2', modelid: this.currentId },
            onSuccess: function(data, msg) {
                _this.currentInfo = data;
                if(callback){
                    callback.call(scope);
                }
            }
        });
    },
    loadLoan: function(callback,scope) {
        var _this = this;
        Chenxin.ajax({
            type: "get",
            dataType: "text",
            paramType: 'json',
            async:false,
            url: '/service/logic/DealLoan.ashx',
            data: { op: 'getmodel1', modelid: this.currentId },
            onSuccess: function(data, msg) {
                _this.currentLoan = data;
                if(callback){
                    callback.call(scope);
                }
            }
        });
    },
    initForm:function(){
        _this = this;
		var recordId = Chenxin.Fn.getQueryString("RecordId");
		if(recordId == null || recordId.isBlank()) {
			alert('参数格式错误,加载失败！');
			return ;
		}
		_this.currentId = recordId;
		_this.loadinfo();
    },
    initEvent: function() {
        /*************事件：关闭*************/
        var _this = this;
        $("#aInputSH").click(function(){
            //审核人输入显示
            if (_this.currentId == null || _this.currentId == "") {
                alert("请先选择一条记录！");
                return;
            }
            _this.loadLoan(function(){
                if(_this.currentLoan.SHDate != null && _this.currentLoan.SHDate != "" && _this.currentLoan.SHDate != undefined)
                {
                    _this.SHEdit();
                }
                else
                {
                    _this.SHInput();
                }
            },this);
        });
        
        $("#aInputFK").click(function(){
            //放款人显示
            if (_this.currentId == null || _this.currentId == "") {
                alert("请先选择一条记录！");
                return;
            }
            _this.loadLoan(function(){
                if(_this.currentLoan.FKDate != null && _this.currentLoan.FKDate != "" && _this.currentLoan.FKDate != undefined)
                {
                    _this.FKEdit();
                }
                else
                {
                    _this.FKInput();
                }
            },this);
        });
        
        $("#aInputSL").click(function(){
            var status = true;
            //受理人输入显示
            if (_this.currentId == null || _this.currentId == "") {
                alert("请先选择一条预审记录！");
                return;
            }
            window.open("/page/Preliminary_Info/DealLoan.aspx?LoanId=" + _this.currentId+"");
        });
        
        $('#aClose').live('click', function() {
            window.close();
            return false;
        });
    },
    /**
    *审核输入
    */
    SHInput: function() {
        var _this = this;
        if (!this.SHInputForm) {
            this.SHInputForm = new Chenxin.UI.SHInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.FKRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.SendToBankDate;
                    delete json.VoucherToBankDate;
                    delete json.CertificateDate;
                    delete json.BankCompleteDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.CompleteLoanDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    window.location.reload();
			    }
            });
        }
        this.SHInputForm.op = "inputsh";
        if(this.SHInputForm.show(this.SHInputForm.op, { modelid: _this.currentId })) {
            this.SHInputForm.reset();
            this.SHInputForm.fitData({
                RecordId:this.currentId
            });
            
            var _data = this.currentLoan;
            this.SHInputForm.fitData(_data);
            this.SHInputForm.setTitle('审核输入');
        }else{
            alert('abc');
        }
    },
    
    /**
    *审核修改
    */
    SHEdit: function() {
        var _this = this;
        
        if (!this.SHInputForm) {
            this.SHInputForm = new Chenxin.UI.SHInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.FKRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.SendToBankDate;
                    delete json.VoucherToBankDate;
                    delete json.CertificateDate;
                    delete json.BankCompleteDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.CompleteLoanDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    window.location.reload();
			    }
            });
        }
        this.SHInputForm.op = "updatesh";
        if(this.SHInputForm.show(this.SHInputForm.op, { currentId: _this.currentId })) {
            this.SHInputForm.reset();
            this.SHInputForm.fitData({
                RecordId:this.currentId
            });
            var _data = this.currentLoan;
            this.SHInputForm.fitData(_data);
            this.SHInputForm.setTitle('审核修改');
        }
    },
    
    /**
    *放款输入
    */
    FKInput: function() {
        var _this = this;
        
        if (!this.FKInputForm) {
            this.FKInputForm = new Chenxin.UI.FKInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.SHRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.BankLoanDate;
                    delete json.ReceiveLoanDate;
                    delete json.SendToBankDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.EstimReportBackDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    window.location.reload();
			    }
            });
        }
        this.FKInputForm.op = "inputfk";
        if(this.FKInputForm.show(this.FKInputForm.op, { currentId: _this.currentId })) {
            this.FKInputForm.reset();
            this.FKInputForm.fitData({
                RecordId:this.currentId
            });
            var _data = this.currentLoan;
            this.FKInputForm.fitData(_data);
            this.FKInputForm.setTitle('放款输入');
        }
    },
    
    /**
    *放款修改
    */
    FKEdit: function() {
        var _this = this;
        
        if (!this.FKInputForm) {
            this.FKInputForm = new Chenxin.UI.FKInputForm({
                scope: _this,
                alwaysCheckPermit: true,
                afterGetFormJson:function(json){
                    delete json.Address;
                    delete json.EmpCompanyId;
                    delete json.EmpDepartId;
                    delete json.EmployeeId;
                    delete json.OperateCompanyId;
                    delete json.OperateDepartId;
                    delete json.OperateUserId;
                    delete json.LoanCode;
                    delete json.LoanInfo;
                    delete json.LoanDealMode;
                    delete json.EvaluateCorp;
                    delete json.InsuranceCorp;
                    delete json.LackInfo;
                    delete json.ReceiveBank;
                    delete json.LoanXfYear;
                    delete json.LoanSxYear;
                    delete json.LoanZyYear;
                    delete json.SalerPhone;
                    delete json.BuyerPhone;
                    delete json.CustomerName;
                    delete json.IDNum;
                    delete json.GJJyear;
                    delete json.SYYear;
                    delete json.OrderPlace;
                    delete json.SaleName;
                    delete json.SaleIDCard;
                    delete json.OldLoanBank;
                    delete json.EmpCompanyName;
                    delete json.EmpDepartName;
                    delete json.EmployeeName;
                    delete json.EmpPhone;
                    delete json.OperateCompanyName;
                    delete json.OperateDepartName;
                    delete json.OperateUserName;
                    delete json.SLRemark;
                    delete json.SHRemark;
                    delete json.EvaluateFee;
                    delete json.InsuranceFee;
                    delete json.AgencyFee;
                    delete json.OutVouchFee;
                    delete json.VouchFee;
                    delete json.LoanXf;
                    delete json.LoanSx;
                    delete json.LoanZy;
                    delete json.BankQueryFee;
                    delete json.BankManageFee;
                    delete json.LoanBankSaleComplete;
                    delete json.EstimatePrice;
                    delete json.GJJmoney;
                    delete json.SYMoney;
                    delete json.OldLoanMoney;
                    delete json.OldRestMoney;
                    delete json.BuildingArea;
                    delete json.LoanContractDate;
                    delete json.MortgageClearDate;
                    delete json.LoanComplete;
                    delete json.BankLoanDate;
                    delete json.ReceiveLoanDate;
                    delete json.SendToBankDate;
                    delete json.SLDate;
                    delete json.SHDate;
                    delete json.FKDate;
                    delete json.UpSLDate;
                    delete json.UpSHDate;
                    delete json.UpFKDate;
                    delete json.EvaluateFeeDate;
                    delete json.VouchFeeDate;
                    delete json.InsuranceFeeDate;
                    delete json.AgencyFeeDate;
                    delete json.OutVouchFeeDate;
                    delete json.EndDate;
                    delete json.EstimReportBackDate;
                    delete json.IsNoEvaluateFee;
                    delete json.IdBankReceipt;
                    delete json.IdZhuanBen;
                    delete json.IsNoAgencyFee;
                    delete json.IdShouBen;
                    delete json.IsLack;
                    delete json.Receipt;
                    delete json.Mortgage;
                    delete json.Status;
                    delete json.CompleteYear;
                    delete json.Total_Floor;
                },
                saveSucc:function(){
                    window.location.reload();
			    }
            });
        }
        this.FKInputForm.op = "updatefk";
        if(this.FKInputForm.show(this.FKInputForm.op, { currentId: _this.currentId })) {
            this.FKInputForm.reset();
            this.FKInputForm.fitData({
                RecordId:this.currentId
            });
            var _data = this.currentLoan;
            this.FKInputForm.fitData(_data);
            this.FKInputForm.setTitle('放款修改');
        }
    },
    loadDefVal:function(){
        _this = this;
		if(_this.currentInfo != undefined)
        {
            Chenxin.Fn.BindData(_this.currentInfo);
        }
    }
});

getcity = true; //设置需要获取城市下拉框数据

$(document).ready(function(){
    var objPage = new Chenxin.UI.ShowDetialLoanPage();
});
